/*
 * URILocator.java
 *
 * Created on June 12, 2005, 11:26 AM
 *
 * (C) R. Alexander Milowski alex@milowski.com
 */

package org.infoset.xml.xerces;

import java.net.URI;
import org.infoset.xml.*;

import org.apache.xerces.xni.*;

/**
 *
 * @author R. Alexander Milowski
 */
public class ItemLocator implements XMLLocator
{
   
   URI uri;
   String uriString;
   Location location;
   /** Creates a new instance of URILocator */
   public ItemLocator(URI base,Location location)
   {
      this.uri = base;
      this.uriString = uri==null ? null : uri.toString();
      this.location = location;
   }

   public String getBaseSystemId()
   {
      return uriString;
   }

   public int getCharacterOffset()
   {
      return -1;
   }

   public int getColumnNumber()
   {
      return location==null ? -1 : location.getColumn();
   }

   public String getEncoding()
   {
      return null;
   }

   public String getExpandedSystemId()
   {
      return uriString;
   }

   public int getLineNumber()
   {
      return location==null ? -1 : location.getLine();
   }

   public String getLiteralSystemId()
   {
      return uriString;
   }

   public String getPublicId()
   {
      return null;
   }

   public String getXMLVersion()
   {
      // TODO: this should be configurable
      return "1.0";
   }
   
}
